home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
taropyon
/
silib
/
silib.lzh
/
PRG
/
SDKFS
/
FSELEV.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-02
|
6KB
|
259 lines
/*************************************************************************
* âCâxâôâg
*************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <silib.h>
#include <sipd.h>
#include <sicoltbl.h>
#include <sifs.h>
#include <EV/evque.h>
#include "sdkfs.h"
#include "sdkfscf.h"
/*************************************************************************
* ÅIù╣âCâxâôâg
*************************************************************************/
int fsEvFunc_exit( int evNo, EVDAT_T *evdat )
{
if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
return (EV_NOTHING);
return (FSEV_EXIT);
}
/*************************************************************************
* âüâjâàü[âCâxâôâg
*************************************************************************/
int fsEvFunc_rightMenu( int evNo, EVDAT_T *evdat )
{
FILESEL_T *fs = evdat->ptr;
if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
return (EV_NOTHING);
FileSel_menu( fs );
return (EV_NOTHING);
}
/*************************************************************************
* âXâNâìü[âïâoü[âCâxâôâg
*************************************************************************/
int fsFunc_sbar( int evNo, SB_T *sb )
{
FILESEL_T *fs = sb->ptr;
if ( fs->posDspTop == sb->top )
return (EV_NOTHING);
fs->posDspTop = sb->top;
FileSel_dspFndat( fs, -1 );
return (EV_NOTHING);
}
/*************************************************************************
* âhâëâCâuò╧ìXâCâxâôâg
*************************************************************************/
int fsEvFunc_chdrv( int drv, EVDAT_T *evdat )
{
FILESEL_T *fs = evdat->ptr;
if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
return (EV_NOTHING);
fs->drv = drv;
return (FSEV_CHDRV);
}
static int fsEvChkFunc_file( EVDAT_T *evdat )
{
struct _evfr_t *para = evdat->para;
if ( para == NULL || evdat->typ != EVTYP_FR )
return (EVCHK_ERR); /* ERROR */
{
FILESEL_T *fs = evdat->ptr;
FNDAT_T *fndat = fs->fnMat[evdat->evNo];
int markMemo = fndat->mark;
FRAME_T *fr = &(para->fr);
POINT_T point = {SiEv->pdX,SiEv->pdY};
int mosx = point.x;
int mosy = point.y;
int evt = 0;
clock_t clk;
if ( mosx < fr->x1 || mosx > fr->x2
|| mosy < fr->y1 || mosy > fr->y2 )
{
return (EVCHK_NO);
}
clk = SI_CLOCK(0) + 20; /* â_âuâïâNâèâbâNè╘èu */
EVQUE_NEXT(SiEv);
evdat->stt |= EVDAT_STT_CHK;
fndat->mark = TRUE; FileSel_dspFndat( fs, evdat->evNo );
/* â{â^âôé≡ùúé╖é╠é≡îƒÅoé╖éΘ */
for(;;)
{
EVQUE_T *que;
EV_sense(SiEv);
if ( (que = EVQUE_CHK(SiEv)) != NULL )
{
if ( (que->typ & EVQUE_MOS_SWOFF) || (que->typ & EVQUE_MOS_MOVE) )
{
int x, y;
x = que->ev.mos.point.x;
y = que->ev.mos.point.y;
if ( x < fr->x1 || x > fr->x2
|| y < fr->y1 || y > fr->y2 )
{ /* ì└òWé¬èOéΩé╜ */
evt = EVCHK_SCLC;
break;
}
if ( (que->typ & EVQUE_MOS_SWOFF) )
{ /* âNâèâbâNâ`âFâbâN */
evt = EVCHK_SCLC;
break;
}
}
EVQUE_NEXT(SiEv);
}
if ( clk < SI_CLOCK(clk) )
{ /* âhâëâbâOâ^âCâv */
evt = EVCHK_DRAG;
break;
}
}
if ( evt == EVCHK_SCLC )
{ /* â_âuâïâNâèâbâNîƒÅo */
clk = SI_CLOCK(0) + 20; /* â_âuâïâNâèâbâNè╘èu */
LOOP
{
EVQUE_T *que;
EV_sense(SiEv);
if ( (que = EVQUE_CHK(SiEv)) != NULL )
{
if ( (que->typ & EVQUE_MOS_SWON) || (que->typ & EVQUE_MOS_MOVE) )
{
int x, y;
x = que->ev.mos.point.x;
y = que->ev.mos.point.y;
if ( x < fr->x1 || x > fr->x2
|| y < fr->y1 || y > fr->y2 )
{ /* ì└òWé¬èOéΩé╜ */
evt = EVCHK_SCLC;
break;
}
if ( (que->typ & EVQUE_MOS_SWON) )
{
evt = EVCHK_DCLC; /* â_âuâïâNâèâbâN */
break;
}
}
EVQUE_NEXT(SiEv);
}
if ( clk < SI_CLOCK(clk) )
{
evt = EVCHK_SCLC; /* âVâôâOâïâNâèâbâN */
break;
}
}
}
if ( evt == EVCHK_DCLC )
EV_waitMosSwOff();
fndat->mark = markMemo; FileSel_dspFndat( fs, evdat->evNo );
evdat->stt &= (~ EVDAT_STT_CHK);
if ( evt )
return (evt); /* âCâxâôâgÄ└ìs */
}
return (EVCHK_NO);
}
/*************************************************************************
* âtâ@âCâïæIæ≡âCâxâôâg
*************************************************************************/
int fsEvFunc_file( int pos, EVDAT_T *evdat )
{
FILESEL_T *fs = evdat->ptr;
FNDAT_T *fndat = fs->fnMat[pos];
int ret;
if ( (ret = fsEvChkFunc_file(evdat)) <= EVCHK_NO )
return (EV_NOTHING);
switch ( ret )
{
case EVCHK_SCLC:
if ( fndat->mark )
{ /* è∙é╔â}ü[âNé│éΩé─éóéΘ */
fndat->mark = FALSE;
fs->buf[0] = '\0';
} else
{ if ( fs->posMark >= 0 )
{ fs->fnMat[fs->posMark]->mark = FALSE;
FileSel_dspFndat( fs, fs->posMark );
}
fndat->mark = TRUE;
fs->posMark = pos;
sprintf( fs->buf, "%s%s", fs->whare, fndat->buf.name );
}
FileSel_dspFndat( fs, pos );
FileSel_dspFnbuf( fs );
return (EV_NOTHING);
case EVCHK_DCLC:
if ( !(fndat->mark) )
{
if ( fs->posMark >= 0 )
{ fs->fnMat[fs->posMark]->mark = FALSE;
FileSel_dspFndat( fs, fs->posMark );
}
fndat->mark = TRUE;
fs->posMark = pos;
}
FileSel_dspFndat( fs, pos );
sprintf( fs->buf, "%s%s", fs->whare, fndat->buf.name );
if ( fndat->buf.attrib & FSATT_DIR )
{ /* âfâBâîâNâgâè */
FS_chdrv( fs->drv );
FS_chdir( fs->buf );
fs->buf[0] = '\0';
ret = FSEV_CHDRV;
} else
ret = FSEV_END;
FileSel_dspFnbuf( fs );
break;
default:
ret = EV_NOTHING;
}
return (ret);
}
/*************************************************************************
* Ä└ìsâLü[âCâxâôâg
*************************************************************************/
int fsEvFunc_exec( int evNo, EVDAT_T *evdat )
{
if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
return (EV_NOTHING);
return (FSEV_END);
}